<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<button id="btn">点击</button>
		<div id="content"></div>
		<script type="text/javascript">
			var btn = document.getElementById("btn");
			var content = document.getElementById("content");
			var nowDate = new Date();
			var oldDate = new Date(2016, 1, 0, 0, 0, 0);
			var chaData = nowDate.getTime() - oldDate.getTime();
			var day = parseInt(chaData / (3600000 * 24));
			var week = parseInt(chaData / (3600000 * 24 * 7));
			var month = nowDate.getMonth() + 1;
			console.log(day);
			console.log(week);
			var arr = [day, week, month];
			var num = 0;
			var timer;
			btn.onclick = function() {
				if(btn.innerHTML == "点击") {
					content.style.display = "block";
					btn.innerHTML = "关闭";
					timer = setInterval(function() {
						if(num > 1) {
							num = -1;
						}
						num++;
						content.innerHTML = arr[num];
					}, 500)

				} else {
					content.style.display = "none";
					btn.innerHTML = "点击";
					clearInterval(timer);

				}
			}
		</script>
	</body>

</html>